<template>
    <div>
        <el-row :gutter="20">
            <el-col :span="4"><div >订单编号</div></el-col>
            <el-col :span="4"><div >病人姓名</div></el-col>
            <el-col :span="8"><div >病症描述</div></el-col>
            <el-col :span="4"><div >医生</div></el-col>
            <!--<el-col :span="4"><div >选择科室</div></el-col>-->
            <!--<el-col :span="4"><div >选择医生</div></el-col>-->
            <!--<el-col :span="3"><div >操作</div></el-col>-->
        </el-row>
        <hr>
        <div class="wrap_item" v-for="order in orinfo" >
            <el-row :gutter="20">
                <el-col :span="4"><div >{{order.id}}</div></el-col>
                <el-col :span="4"><div >{{order.patientname}}</div></el-col>
                <el-col :span="8"><div >{{order.symptom}}</div></el-col>
                <el-col :span="4"><div >{{order.doctor}}</div></el-col>
            </el-row>
            <hr>
        </div>
    </div>
</template>

<script>
  export default {
    name: "unchecked",
    data() {
      return{
        orinfo: [],
        option: [],
        tyinfo: [],
        dcinfo: [],
        form: {
          value: '',
          value1: '',
        },
        value: '',
        value1: '',
        formLabelWidth: '80px',
        dialogFormVisible: false,
      }
    },
    methods: {
      getList: function () {
        this.$ajax.get('http://47.75.110.31:8080/orinfo/findByStatus?status=1')
          .then(response => {
            this.orinfo = response.data;
          })
      },
      Detail (orderid) {
        this.dialogFormVisible = true;
        localStorage.setItem("orderId",orderid);
        console.log(orderid);
      },
      selectTy(){
        this.$ajax.get('http://47.75.110.31:8080/tyinfo/findAll')
          .then(response => {
            this.tyinfo = response.data;
            console.log(this.tyinfo[0].tyname)
          })
      },
      selectDoctor(){
        this.$ajax.get('http://47.75.110.31:8080/dcinfo/findByType?type='+this.value)
          .then(response => {
            this.dcinfo = response.data;
            console.log(this.tyinfo[0].tyname)
          })
      },
      toDetail () {
        var orderId = localStorage.getItem("orderId");
        console.log(orderId)
        this.updatedc(orderId);
        if(this.value1===''){
          alert('请选择医生姓名')
        }
        this.$ajax.post('http://47.75.110.31:8080/orinfo/updatedoctor?id='+orderId+'&doctor='+this.value1,
          {

            headers: {
              'Content-Type': 'application/json;charset=UTF-8'
            }
          }
        ).then(response => {
          console.log(response.data);
          if (response.data === "success") {
            this.$message({
              message: '恭喜你添加成功',
              type: 'success'
            });
            location.reload();
          }
        })
      },
      updatedc(orderId){
        this.$ajax.post('http://47.75.110.31:8080/orinfo/updatestatus?status=1&id='+orderId,
          {
            headers: {
              'Content-Type': 'application/json;charset=UTF-8'
            }
          }
        ).then(response => {
        })
      }
    },
    mounted () {
      this.getList()
    }
  }

</script>

<style scoped>

</style>
